package com.ybkj.chat.module.main.activity;

import android.widget.ImageView;

import com.ybkj.chat.R;
import com.ybkj.chat.base.BaseMvpActivity;
import com.ybkj.chat.manager.ActivityManager;
import com.ybkj.chat.ui.adapter.StrangerDynamicsAdapter;
import com.ybkj.chat.ui.dialog.PpwEditMenu;
import com.ybkj.chat.ui.view.recyclerview.XRecyclerView;
import com.ybkj.chat.ui.view.refreshlayout.XRefreshLayout;
import com.ybkj.chat.utils.ResourcesUtil;

import butterknife.BindView;

/**
 * 附近陌生人动态
 */
public class StrangerDynamicsActivity extends BaseMvpActivity {


    @BindView(R.id.recycle)
    XRecyclerView recycle;
    @BindView(R.id.refresh_layout)
    XRefreshLayout refreshLayout;
    @BindView(R.id.head_right_img)
    ImageView headRightImg;

    private StrangerDynamicsAdapter strangerDynamicsAdapter;
    private PpwEditMenu mPpwMessageMenu;

    @Override
    protected void injectPresenter() {

    }

    @Override
    protected void initTitle() {
        setTitleText("附近陌生人动态");
        setRightImg(ResourcesUtil.getDrawable(R.drawable.icon_edit_logo));
    }


    @Override
    protected int getLayoutId() {
        return R.layout.activity_stranger_dynamics;
    }

    @Override
    protected void initView() {
        initPop();
    }

    private void initPop() {
        mPpwMessageMenu = new PpwEditMenu(mContext);
        mPpwMessageMenu.setOnMenuButtonCLickListener(new PpwEditMenu.OnMenuButtonClickListener() {
            @Override
            public void onPictureButtonClick() {
                ActivityManager.gotoActivity(mContext, SendPictureActivity.class);
            }

            @Override
            public void onPhotoButtonClick() {
                ActivityManager.gotoActivity(mContext, SendPictureActivity.class);
            }

            @Override
            public void onVideoButtonClick() {
                ActivityManager.gotoActivity(mContext, SendVideoActivity.class);
            }

            @Override
            public void onMoreButtonClick() {

            }
        });
    }

    @Override
    protected void initData() {
        strangerDynamicsAdapter = new StrangerDynamicsAdapter(mContext);
        strangerDynamicsAdapter.addData("1");
        strangerDynamicsAdapter.addData("1");
        strangerDynamicsAdapter.addData("1");
        strangerDynamicsAdapter.addData("1");
        strangerDynamicsAdapter.addData("1");
        strangerDynamicsAdapter.bindToRecyclerView(recycle);

    }

    @Override
    public void onRightImgClick() {
        super.onRightImgClick();
        mPpwMessageMenu.showAsDropDown(headRightImg, 0, 0);
        mPpwMessageMenu.setBackgroundAlpha(mContext, 0.5f);
    }

}
